package hotciv.common;

import hotciv.framework.City;
import hotciv.framework.GameConstants;
import hotciv.framework.Player;

public class CityImpl implements City
{
  
	private String unitType;
	private Player player;
	private String workforceFocus;
	private int size = 1;
	private int foodAmount = 0;
	private int productionAmount = 0;
	public CityImpl(Player player, String unitType, String workforceFocus)
	{
		this.player = player;
		if (unitType == GameConstants.ARCHER || unitType == GameConstants.LEGION || unitType == GameConstants.SETTLER)
			this.unitType = unitType;
		else 
			this.unitType = GameConstants.ARCHER; //hvis alt andet fejler -> Archer. 
		
		if(workforceFocus == GameConstants.productionFocus || workforceFocus == GameConstants.foodFocus)
			this.workforceFocus = workforceFocus;
		else
			this.workforceFocus = GameConstants.foodFocus;
	}
	
		/** return the owner of this city.
		* @return the player that controls this city.
		*/
	 public Player getOwner()
	 {
		 return player;
	 }
			  
			  /** return the size of the population.
			   * @return population size.
			   */
	 public int getSize()
	 {
		return size;
	 }
	
			  /** return the type of unit this city is currently producing.
			   * @return a string type defining the unit under production,
			   * see GameConstants for valid values.
			   */
	 public String getProduction()
	 {
		 return unitType;
	 }
	
			  /** return the work force's focus in this city.
			   * @return a string type defining the focus, see GameConstants
			   * for valid return values.
			   */
	 public String getWorkforceFocus()
	 {
		 return workforceFocus;
	 }
	 
	 public void setSize(int size) {
		 this.size = size;
	 }
	 public void setProduction(String unitType) {
		 this.unitType = unitType;
	 }
	 public void setWorkforceFocus(String workforceFocus) {
		 this.workforceFocus = workforceFocus;
	 }
	 public void setOwner(Player player) {
		 this.player = player;
	 }
	 public int getFoodStock() {
		 return foodAmount;
	 }
	 public void setFoodStock(int foodAmount) {
		 this.foodAmount = foodAmount;
	 }
	 public int getProductionStock() {
		 return productionAmount;
	 }
	 public void setProductionStock(int productionAmount) {
		 this.productionAmount = productionAmount;
	 }
}
